<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="lilei.css">
</head>

<body>
  <div id="dljm" class="container">
    <div id="dlck">
        <div class="row" style="height: 100px;">
            <div style="position: absolute;font-size: 30px;width: 200px;margin-left:200px;margin-top: 50px;">登录控制台</div>

        </div>
        <div class="row" style="height:170px;">
            <div style="margin-top: 30px;margin-bottom: 20px;">
                <span style="margin-left: 100px;">账户：</span>
                <input id="account" type="text" v-model="account" style="margin-left: 30px;width:250px;height: 25px;" placeholder="账户：请输入账户名">
            </div>
            <div style="margin-top: 15px;margin-bottom: 20px;">
                <span style="margin-left: 100px;">密码：</span>
                <input id="pwd" type="text" v-model="pwd" style="margin-left: 30px;width:250px;height: 25px;" placeholder="密码：请输入密码">
            </div>
            <div style="margin-top: 15px;margin-bottom: 20px;">
                <span style="margin-left: 83px;">验证码：</span>
                <input id="yzm" type="text" v-model="yzm" style="margin-left: 30px;width:250px;height: 25px;" placeholder="验证码：请输入验证码">
            </div>

        </div>
        <div>
            <div style="margin-left: 140px;">
              <button id="login_button" v-on:click="login(account,pwd)" style="width: 300px;height: 50px;line-height: 10px;">登    录</button>
            </div>
        </div>

    </div>
  </div>

    <!-- 引入VUE -->
    <script src="plugins/vue-2.6.10/vue-resource.min.js"></script>
    <script src="plugins/vue-2.6.10/vue.js"></script>
    <!-- 引入axios -->
    <script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script>
    <script>
        new Vue({
			el:"#dlck",
			data:{
				account:"",
                pwd:"",
                yzm:""
			},
			methods:{
				login:function(account,pwd){
                    axios
                        ({
                            url:'user/login',
                            method:'post',
                                    params:{
                                'account':account,
                                'pwd':pwd,
                             },    
                        })
                        .then(res=>{
                            console.info(res.data.message)
                            if (res.data.message=='登录成功') {
                                window.location.href = "/index.html";
                            }
                            else{
                                alert('登录错误')
                            }
                        })
				}
			}
		});
    </script>
</body>

</html>